From b4e6e6554522bc712eb9c24717027ce39e7c03b4 Mon Sep 17 00:00:00 2001 From: "emellor@ewan" Date: Tue, 27 Sep 2005 22:03:55 +0100 Subject: [PATCH] Added sxprs, for xm block-list. --- tools/python/xen/xend/server/DevController.py | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tools/python/xen/xend/server/DevController.py b/tools/python/xen/xend/server/DevController.py index 0b0643c279..5729e3e2b8 100644 --- a/tools/python/xen/xend/server/DevController.py +++ b/tools/python/xen/xend/server/DevController.py @@ -81,6 +81,22 @@ class DevController: xstransact.Remove(backpath) + def sxprs(self): + """@return an s-expression describing all the devices of this + controller's device-class. + """ + path = self.frontendRoot() + while True: + t = xstransact(path) + try: + listing = t.list_recursive() + if t.commit(): + return listing + except: + t.abort() + raise + + def sxpr(self, devid): """@return an s-expression describing the specified device. """ @@ -126,8 +142,8 @@ class DevController: compulsory to use it; subclasses may prefer to allocate IDs based upon the device configuration instead. """ + path = self.frontendMiscPath() while True: - path = self.frontendMiscPath() t = xstransact(path) try: result = t.read("nextDeviceID") @@ -196,8 +212,11 @@ class DevController: def frontendPath(self, devid): - return "%s/device/%s/%d" % (self.vm.getPath(), self.deviceClass, - devid) + return "%s/%d" % (self.frontendRoot(), devid) + + + def frontendRoot(self): + return "%s/device/%s" % (self.vm.getPath(), self.deviceClass) def frontendMiscPath(self): -- 2.30.2